package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;
import com.zr.model.Deliverypoint;
import com.zr.service.DeliverypointServiceLPN;
import com.zr.service.DistributionscopeServiceLPN;

import net.sf.json.JSONArray;

public class DistributionscopeActionLPN extends ActionSupport implements SessionAware,ServletRequestAware,ServletResponseAware{
	private HttpServletRequest req;
	private HttpServletResponse resp;
	private Map<String, Object> session;
	private int dpId;
	
	public int getDpId() {
		return dpId;
	}
	public void setDpId(int dpId) {
		this.dpId = dpId;
	}
	//属性注入
	@Resource
	private   DistributionscopeServiceLPN dss;
	public void getDS() throws IOException{
		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("utf-8");
		System.out.println(dpId);
		JSONArray j = dss.findDS(dpId);
		PrintWriter pw = resp.getWriter();
		pw.write(j.toString());
	}
	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		// TODO Auto-generated method stub
		this.resp=arg0;
	}
	@Override
	public void setServletRequest(HttpServletRequest arg0) {
		// TODO Auto-generated method stub
		this.req=arg0;
	}
	@Override
	public void setSession(Map<String, Object> arg0) {
		// TODO Auto-generated method stub
		this.session=arg0;
	}
}
